<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>
        <input type="text" id="usernname">
    </p>
    <p> 
        <input type="text" name="" id="age">
    </p>
    <p>
        <input type="button" value="提交" id="btn">
    </p>
    <script>
        var btn = document.getElementById('btn');
        var usernname = document.getElementById('usernname');
        var age = document.getElementById('age');
        btn.onclick = function(){
            var xhr = new XMLHttpRequest();
            var namevalue = usernname.value;
            var agevalue = age.value;
            var parse = 'usernname='+namevalue+'&age=' + agevalue;
            xhr.open('get', 'http://localhost:3000/get?'+parse);
            xhr.send();
            xhr.onload = function(){
                console.log(xhr.responseText);
            }
        }
    </script>
</body>
</html>